<template>
  <div class="switch">
    <el-table :data="title" @row-click="article">
      <el-table-column prop="title">
        <template slot-scope="scope">
          <i class="arrow el-icon-arrow-right"></i>
          {{ scope.row.title }}
        </template>
      </el-table-column>
    </el-table>
    <el-button
      type="primary"
      @click="goindustry"
      style="background-color: #084fb0; border-color: #084fb0"
      >查看更多
    </el-button>
  </div>
</template>
<script>
import { contentindustry } from "@/api";
export default {
  name: "Industry",
  data() {
    return {
      title: [],
    };
  },
  created() {
    contentindustry().then((res) => {
      const data = res.data;
      this.title = data.slice(0, 5);
    });
  },
  methods: {
    goindustry() {
      this.$emit("industry", false);
      this.$router.push({
        path: "/more-text",
        query: { key: "行业动态", more: 5, article: 0, apinum: 4 },
      });
    },
    article(row, event, column) {
      console.log(row, event, column);
      this.$router.push({
        path: "/more-text",
        query: { key: "行业动态", more: 5, article: 4, id: row.id },
      });
    },
  },
};
</script>
